package com.bifang.module.file.common.enums;

/**
 * 文件服务类型
 *
 * @author chenzh
 * @date 2019-08-12
 */
public enum FileServiceTypeEnum {
    FTP("ftp", "通过ftp上传"),
    SFTP("sftp", "通过sftp上传"),
    FASTDFS("fastdfs", "通过fastDfs上传"),
    SOCKET("socket", "通过socket上传"),
    LOCAL("local", "上传到服务本地"),
    HTTP("http", "上传到http提供的文件服务上"),
    ALIOSS("aliOSS", "阿里云文件服务器"),
    MOBILEOSS("mobileOSS", "移动文件服务器"),
    WOCLOUDOSS("woCloudOSS", "沃云文件服务器"),
    ;

    private String type;
    private String name;

    FileServiceTypeEnum(String type, String name) {
        this.type = type;
        this.name = name;
    }

    public String getType() {
        return this.type;
    }

    public String getName() {
        return this.name;
    }

    public static FileServiceTypeEnum getByType(String type) {

        for (FileServiceTypeEnum typeEnum : values()) {
            if (typeEnum.getType() == type) {
                return typeEnum;
            }
        }
        return null;
    }
}
